/* 
 * File:   TableTranscriber.h
 * Author: Guilherme Monteiro
 *
 */

#ifndef TABLETRANSCRIBER_H
#define	TABLETRANSCRIBER_H

#include <string>
#include <cv.h>
#include <highgui.h>

#include "VectorROIsCreator.h"
#include "Heuristic.h"
#include "FileWriter.h"
#include "FalsePositiveRemover.h"
#include "CellsCreator.h"
#include "GenericModel.h"
#include "VerticalTableHandler.h"
#include "TranscriberMetaInfo.h"
#include "InvalidRotatedTagException.h"
#include "InvalidRotatedTagException.h"
#include "GenericAdapter.h"

using namespace std;

/**
 * Class that represents the table transcriber itself,
 * this is the principal class of TableTranscriberApp.
 * 
 * @author Guilherme Monteiro
 * 
 */
class TableTranscriber {
public:
    TableTranscriber(string pathLowResolutionPage, GenericModel* model, string rotatedTag);
    TableTranscriber(const TableTranscriber& orig);
    virtual ~TableTranscriber();
    void run() throw (NullImageException);
private:
    TranscriberMetaInfo* metaInfo;
    GenericModel* model;
    bool isRotated;

    IplImage* cutAndSaveLowImage(ROI* roi) throw (NullImageException);
    void createModelPreview(ROI* roi, IplImage* img, vector<Cell> cells);
    void setRotation(string rotatedTag) throw (InvalidRotatedTagException);
};

#endif	/* TABLETRANSCRIBER_H */

